From: Andre Nijman Date: Mon, 8 Jun 2026 05:45:01 +0000 (+0800) Subject: workspace: Avoid redundant boundingBox copies in window layout X-Git-Tag: archive/raspbian/50.5-1+rpi1^2~14^2^2~8 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=479e2ac76e034f3e80b3933c6c4c50bf04d61449;p=gnome-shell.git workspace: Avoid redundant boundingBox copies in window layout WorkspaceLayout's allocation reads child.boundingBox four times for each window on every frame of an overview transition. The getter returns a fresh copy of the cached box on every access, so this is four throwaway objects per window per frame feeding the garbage collector. Read the box into a local once and use that. The values are identical; only the per-frame allocations go away. Part-of: (cherry picked from commit d4b5bc781535104475fba490fccfb0dd7934c96f) --- diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 5c043e4be..3c8ed9f41 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -707,10 +707,11 @@ export const WorkspaceLayout = GObject.registerClass({ let workspaceBoxWidth, workspaceBoxHeight; if (windowInfo.metaWindow.showing_on_its_workspace()) { - workspaceBoxX = (child.boundingBox.x - workareaX) * allocationScale; - workspaceBoxY = (child.boundingBox.y - workareaY) * allocationScale; - workspaceBoxWidth = child.boundingBox.width * allocationScale; - workspaceBoxHeight = child.boundingBox.height * allocationScale; + const {boundingBox} = child; + workspaceBoxX = (boundingBox.x - workareaX) * allocationScale; + workspaceBoxY = (boundingBox.y - workareaY) * allocationScale; + workspaceBoxWidth = boundingBox.width * allocationScale; + workspaceBoxHeight = boundingBox.height * allocationScale; } else { workspaceBoxX = workareaX * allocationScale; workspaceBoxY = workareaY * allocationScale;